From c83d86e8c0b49bceea7ae732524e287a133942db Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Fri, 14 Aug 2015 22:32:48 -0700 Subject: [PATCH] Make activation_error always return an error. --- src/cargo/core/resolver/mod.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/cargo/core/resolver/mod.rs b/src/cargo/core/resolver/mod.rs index f89e25d45..b290884ab 100644 --- a/src/cargo/core/resolver/mod.rs +++ b/src/cargo/core/resolver/mod.rs @@ -398,8 +398,8 @@ fn activate_deps<'a>(cx: Box, // Oh well, we couldn't activate any of the candidates, so we just can't // activate this dependency at all - Ok(activation_error(&cx, registry, last_err, parent, dep, prev_active, - &candidates)) + Ok(Err(activation_error(&cx, registry, last_err, parent, dep, prev_active, + &candidates))) } #[inline(never)] // see notes at the top of the module @@ -410,9 +410,9 @@ fn activation_error(cx: &Context, parent: &Summary, dep: &Dependency, prev_active: &[Rc], - candidates: &[Rc]) -> CargoResult> { + candidates: &[Rc]) -> Box { match err { - Some(e) => return Err(e), + Some(e) => return e, None => {} } if candidates.len() > 0 { @@ -447,7 +447,7 @@ fn activation_error(cx: &Context, .collect::>() .connect(", "))); - return Err(human(msg)) + return human(msg) } // Once we're all the way down here, we're definitely lost in the @@ -467,7 +467,10 @@ fn activation_error(cx: &Context, let mut msg = msg; let all_req = semver::VersionReq::parse("*").unwrap(); let new_dep = dep.clone().set_version_req(all_req); - let mut candidates: Vec = try!(registry.query(&new_dep)); + let mut candidates: Vec = match registry.query(&new_dep) { + Ok(candidates) => candidates, + Err(e) => return e, + }; candidates.sort_by(|a, b| { b.version().cmp(a.version()) }); @@ -492,7 +495,7 @@ fn activation_error(cx: &Context, a path dependency's locked version"); } - Err(human(msg)) + human(msg) } // Returns if `a` and `b` are compatible in the semver sense. This is a -- 2.30.2